<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta name="_token" content="{{ csrf_token() }}"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title>添加商品</title>
<link rel="stylesheet" href="{{ asset('admin_style/css/pintuer.css') }}">
   <link rel="stylesheet" href="{{ asset('admin_style/css/admin.css') }}">
    <script src="{{asset('admin_style/js/jquery.js')}}"></script>
    <script src="{{asset('admin_style/js/pintuer.js')}}"></script>
<link rel="stylesheet" href="{{asset('admin_style/css/style.css')}}">
<!--<link rel="stylesheet" href="css/ace.min.css">-->


<link rel="stylesheet" href="{{ asset('admin_style/js/umeditor/themes/default/css/umeditor.css')}}">
<script type="text/javascript" src="{{ asset('admin_style/js/jeDate/jedate.js')}}"></script>
</head>
<body>
  <div class="panel admin-panel">
      <div class="panel-head"><strong class="icon-reorder"> 添加新商品</strong></div>
    	<div class="tab-box">
					<div class="tab">
						<div class="tab-head">
							<ul class="tab-nav">
								<li><a href="#tab-a">通用信息</a></li>
							</ul>
						</div>
						<div class="tab-body">
						<div class="tab-panel active" id="tab-a">
							<div class="product-mulde">
						      	<form class="form-x" action="{{ url('goods/add_do')}}" method="post" enctype="multipart/form-data">
										<div class="form-group">
											<div class="label">
												<label>商品名称：</label>
											</div>
											<div class="field">
												<input type="text" class="input" name="g_name" value="{{old('g_name')}}" />
												@if($errors->has('g_name'))
													<span style="color:red">{{$errors->first('g_name')}}</span>
												@endif
											</div>
										</div>
										<div class="form-group">
											<div class="label">
												<label>商品货号：</label>
											</div>
											<div class="field field-tsa">
												<input type="text" class="input" name="g_huohao" />
												<p>如果您不输入商品货号，系统将自动生成一个唯一的货号。</p>
											</div>
										</div>
										<div class="form-group">
											<div class="label">
												<label>商品分类：</label>
											</div>
											<div class="field">
												<select class="input" name="g_cate">
													<option value="w">请选择分类</option>
													@foreach($data as $value)
														<option value="{{$value->cate_id}}">{{$value->cate_name}}</option>
													@endforeach
												</select>
											</div>
										</div>
										<div class="form-group">
											<div class="label">
												<label>现价：</label>
											</div>
											<div class="field">
												<input type="text" class="input" name="g_price" value="{{old('g_price')}}" />
												@if($errors->has('g_price'))
													<span>{{$errors->first('g_price')}}</span>
												@endif
											</div>
										</div>
										<div class="form-group">
											<div class="label">
												<label>原价：</label>
											</div>
											<div class="field">
												<input type="text" class="input" name="g_original_price" value="{{old('g_original_price')}}" />
												@if($errors->has('g_original_price'))
													<span>{{$errors->first('g_original_price')}}</span>
												@endif
											</div>
										</div>
										<div class="form-group">
											<div class="label">
												<label>商品库存数量：</label>
											</div>
											<div class="field field-tsa">
												<input type="text" class="input" name="g_reper" value="{{old('g_reper')}}" />
													@if($errors->has('g_reper'))
														<span style="color:red">{{$errors->first('g_reper')}}</span>
													@endif
												<p>库存在商品为虚货或商品存在货品时为不可编辑状态，库存数值取决于其虚货数量或货品数量。</p>
											</div>
										</div>
										<div class="form-group">
											<div class="label">
												<label>是否为精品：</label>
											</div>
											<div class="field">
								                <input type="radio" name="g_boutique" value="1" checked="checked">精品
                                                <input type="radio" name="g_boutique" value="2">非精品
											</div>
										</div>
                                        <div class="form-group">
                                            <div class="label">
                                                <label>是否为特价：</label>
                                            </div>
                                            <div class="field">
                                                <input type="radio" name="g_special" value="1" c>特价
                                                <input type="radio" name="g_special" value="2" checked="checked">非特价
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="label">
                                                <label>是否为热销：</label>
                                            </div>
                                            <div class="field">
                                                <input type="radio" name="g_hot" value="1" checked="checked">热销
                                                <input type="radio" name="g_hot" value="2">非热销 
                                            </div>
                                        </div>
										<div class="form-group">
											<div class="label">
												<label>是否上架：</label>
											</div>
											<div class="field">
											     <input type="radio" name="g_putaway" value="1" checked="checked">上架
                                                 <input type="radio" name="g_putaway" value="2">下架
											</div>
										</div>
										<div class="form-group">
											<div class="label">
												<label>商品简单描述：</label>
											</div>
											<div class="field">
												<textarea class="input" name="g_desc"  />{{old('g_desc')}}</textarea>
												@if($errors->has('g_desc'))
													<span style="color:red">{{$errors->first('g_desc')}}</span>
												@endif
											</div>
										</div>
										<div class="form-group">
											<div class="label">
												<label>上传商品图片：</label>
											</div>
											<div class="field">
									           <input type="file" class="button bg-blue margin-left" id="image1" name="g_img" value="+ 浏览上传" >
									        	<div class="clear"></div>
											</div>
											
											<div class="field margin-large-top text-center">
												<input type="hidden" name="_token" value="{{csrf_token()}}">
												<input type="submit" value="确定" class="button bg-green">
												<input type="reset" name="button" id="button" value="重置" class="button bg-red">
											</div>
										</div>
									</form>
							</div>
						</div>
							
			</div>
							
  </div>

<script type="text/javascript">
	$(function(){
  $(":radio").click(function(){
    if($(this).val()=="默认"){
    $(this).parent().children("p").text("使用系统默认的价格模式,统一使用一样的价格");
    }else if($(this).val()=="仓库"){
    	 $(this).parent().children("p").text("使用仓库的价格模式,根据不同仓库调取不同价格");
    }else{
    	 $(this).parent().children("p").text("使用地区的价格模式,根据不同地区调取不同价格");
    }
  });
 });
</script>
<script type="text/javascript" src="{{asset('admin_style/js/jquery.js')}}"></script>
<script type="text/javascript" charset="utf-8" src="{{asset('admin_style/js/umeditor/umeditor.config.js')}}"></script>
<script type="text/javascript" charset="utf-8" src="{{asset('admin_style/js/umeditor/umeditor.min.js')}}"></script>
<script type="text/javascript" charset="utf-8" src="{{asset('admin_style/js/umeditor/lang/zh-cn/zh-cn.js')}}"></script>
<script type="text/javascript">
	$('#select_a').change(function(){
		//获取选中下拉框的值
		var se = $(this).val();
		//用ajax把传递过来的值传递到后台
		$.ajax({
			url : "{{ url('goods/attr/')}}/"+se,
			type:'get',
			contentType:false,//设置编码
            processData:false,
            dataType: "json",
            success:function(msg){
            	$('#select_b').empty();
            	//console.log(msg);
            	$(msg).each(function(index,item){
            		//分割字符串
            		var type = item['type_value'];
            		var arr = type.split('|');
            		$("#select_b").append('<br/>请您选择<b>'+item['type_name']+'</b>  :');

            		for(var i in arr){
            			$("#select_b").append(''+arr[i]+'<input type="checkbox" onclick="check()" name="test" value="'+arr[i]+'">'); 
            		}
                    
            	});
            }
		});
	});

    var umMonth = UM.getEditor('editor-year');
    $('select').select();
    function check(){
        //var type_value = $(this).val();
         chk_value =[];
        $('input[name="test"]:checked').each(function(){
            chk_value.push($(this).val());
            
        });
        
        
         /*$.ajax({
                url : "{{ url('goods/goods_select')}}",
                data: {type_name:chk_value},
                type: 'get',
                dataType: "json",
                success:function(msg){
                    console.log(msg);
                    //$('.box').append(msg);
                }
            });*/
        console.log(chk_value);   

    }
</script>
   <script type="text/javascript">
    //jeDate.skin('gray');
    jeDate({
		dateCell:"#dateinfo",
		format:"YYYY-MM-DD hh:mm:ss",
		isinitVal:true,
		isTime:true, //isClear:false,
		minDate:"2017-01-08 00:00:00",
	})
    jeDate({
		dateCell:"#dateinfoa",
		format:"YYYY-MM-DD hh:mm:ss",
		isinitVal:true,
		isTime:true, //isClear:false,
		minDate:"2017-01-08 00:00:00",
	})
    jeDate({
		dateCell:"#dateinfob",
		format:"YYYY-MM-DD hh:mm:ss",
		isinitVal:true,
		isTime:true, //isClear:false,
		minDate:"2017-01-08 00:00:00",
	})
    jeDate({
		dateCell:"#dateinfoc",
		format:"YYYY-MM-DD hh:mm:ss",
		isinitVal:true,
		isTime:true, //isClear:false,
		minDate:"2017-01-08 00:00:00",
	})
	




     
</script>
</body>
</html>



  
